package com.powervision.mvvmdemo.ui.http

import com.powervision.base.util.Constants
import com.powervision.http.entity.ApiResponse
import com.powervision.mvvmdemo.ui.model.*
import retrofit2.http.*

interface ApiService {

    @FormUrlEncoded
    @POST(Constants.USER_LOGIN_URL)
    suspend fun login(@Field("username") userName: String, @Field("password") passWord: String): ApiResponse<UserModel?>

    @POST(Constants.USER_REGISTER_URL)
    suspend fun register(@Query("username")username:String, @Query("password")password:String, @Query("repassword")repassword:String):ApiResponse<UserModel?>

    @GET(Constants.USER_LOGOUT_URL)
    suspend fun logout():ApiResponse<String?>

    @GET(Constants.ARTIST_LIST_URL)
    suspend fun artList(@Path("page") page:Int):ApiResponse<ArticleListModel?>

    @GET(Constants.TREE_LIST_URL)
    suspend fun knowLedge():ApiResponse<List<KnowledgeModel.DataBean?>>

    @GET(Constants.BANNER_URL)
    suspend fun banner():ApiResponse<List<BannerModel>>

    @GET(Constants.PROJECT_TREE_URL)
    suspend fun project():ApiResponse<List<KnowledgeModel.DataBean?>>

    @GET(Constants.PROJECT_LIST_URL)
    suspend fun projectList(@Path("page") page:Int,@Query("cid") cid:Int):ApiResponse<ProjectListModel>

    @GET(Constants.NAVI_URL)
    suspend fun nav():ApiResponse<List<NaviModel>>

    @GET(Constants.ARTICLE_SEARCH_URL)
    suspend fun searchArticle(@Path("page") page:Int,@Query("author") author:String):ApiResponse<List<SearchArticleModel>>

    @GET(Constants.FRIEND_URL)
    suspend fun friend():ApiResponse<List<CategoryModel>>

    @GET(Constants.HOTKEY_URL)
    suspend fun hotKey():ApiResponse<List<HotKeyModel>>

    @GET(Constants.ARTICLE_TOP_URL)
    suspend fun top():ApiResponse<List<DataBean>>

    @GET(Constants.WXARTICLE_URL)
    suspend fun wxArticle():ApiResponse<List<KnowledgeModel.DataBean>>

    @GET(Constants.WXARTICLE_LIST_URL)
    suspend fun wxArticleList(@Path("page") page:Int,@Path("id") id:String):ApiResponse<ArticleListModel>

    @GET(Constants.WXARTICLE_SEARCH_LIST_URL)
    suspend fun wxArticleSearchList(@Path("page") page:Int,@Path("id") id:String,@Query("k") keyword:String):ApiResponse<ArticleListModel>

    @GET(Constants.LIST_PROJECT_URL)
    suspend fun listProject(@Path("page") page: Int):ApiResponse<ArticleListModel>

    @GET(Constants.USER_ARTICLE_URL)
    suspend fun userArticle(@Path("page") page: Int):ApiResponse<ArticleListModel>
}